package com.dg.river.module.main.presenter;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.dg.river.module.base.listener.IBaseListListener;
import com.dg.river.module.base.listener.IBaseObjectListener;
import com.dg.river.module.base.presenter.BasePresenterImpl;
import com.dg.river.module.main.bean.UserInfoBean;
import com.dg.river.module.main.contract.DemoContract;
import com.dg.river.module.main.model.DemoModel;

import java.util.List;

/**
 * @作者：Hututu
 * @时间：2023/10/7 14:07
 * @描述：内容描述
 * @修改：修改内容
 * @Version:1.0
 */
public class DemoPresenter extends BasePresenterImpl<DemoContract.IDemoView, DemoModel> implements DemoContract.IDemoPresenter {

    @Override
    public void demoFun1(@NonNull String value) {
        getModel().demoFun1(value, new IBaseListListener<UserInfoBean>() {
            @Override
            public void loadSuccess(@Nullable List<? extends UserInfoBean> list) {
                getView().demoFun1Success("123");
            }

            @Override
            public void loadFailure(@Nullable String exception) {
                getView().demoFun1Failure(exception);
            }
        });
    }

    @Override
    public void demoFun2(@NonNull String value) {
        getModel().demoFun2(value, new IBaseObjectListener<UserInfoBean>() {
            @Override
            public void loadSuccess(UserInfoBean userInfoBean) {
                getView().demoFun2Success("");
            }

            @Override
            public void loadFailure(@Nullable String exception) {
                getView().demoFun2Failure(exception);
            }
        });
    }
}
